package learning.objectStream;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.ObjectInputStream;

public class ObjectStream2 {
	public static void main(String[] args) {
		try {
			ObjectInputStream ois=new ObjectInputStream(new FileInputStream("myfile/my.txt"));
            p(ois.readObject());
            p(ois.readBoolean());
            Object o=ois.readObject();
            Animal an=(Animal)o;
            p(an);
            
//            int b=0;
//            while((b=ois.readByte())!=-1){
//            	p((char)b);
//            	
//            }
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
    static void p(Object o){
    	System.out.println(o);
    }
}
